//
//  OrderCell.m
//  xpkc
//
//  Created by TopSageMacMini on 14/12/19.
//  Copyright (c) 2014年 wanmeizty. All rights reserved.
//

#import "OrderCell.h"

@implementation OrderCell

- (void)awakeFromNib {
    
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self) {
        [self configUI];
    }
    return self;
}

- (void)configUI {
    // 间隔视图
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 15)];
    [bgView setBackgroundColor:RGBCOLOR(231, 236, 237)];
    [self addSubview:bgView];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 25, 80, 25)];
    [self.titleLabel setTextAlignment:NSTextAlignmentLeft];
    [self.titleLabel setFont:[UIFont systemFontOfSize:20]];
    [self addSubview:self.titleLabel];
    
    self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-230, 30, 250, 25)];
    [self.numberLabel setTextAlignment:NSTextAlignmentCenter];
    [self.numberLabel setFont:[UIFont systemFontOfSize:12]];
    [self.numberLabel setTextColor:[UIColor darkGrayColor]];
    [self addSubview:self.numberLabel];
    
    for(int i=0;i<2;i++) {
        UILabel *lineLabel = [[UILabel alloc] init];
        if(i == 0) {
            [lineLabel setFrame:CGRectMake(0, 60, SCREEN_WIDTH-20, 2)];
        } else {
            [lineLabel setFrame:CGRectMake(20, 135, SCREEN_WIDTH-20, 2)];
        }
        [lineLabel setBackgroundColor:RGBCOLOR(231, 236, 237)];
        [self addSubview:lineLabel];
    }
    
    self.courseNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 70, SCREEN_WIDTH-50, 30)];
    self.courseNameLabel.numberOfLines=0;
    self.courseNameLabel.adjustsFontSizeToFitWidth=YES;
    [self.courseNameLabel setTextAlignment:NSTextAlignmentLeft];
    [self.courseNameLabel setTextColor:[UIColor blackColor]];
    [self.courseNameLabel setFont:[UIFont systemFontOfSize:15]];
    [self addSubview:self.courseNameLabel];
    
    
    
    self.subCourerLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 100, SCREEN_WIDTH-75, 20)];
    self.subCourerLabel.numberOfLines=0;
    self.subCourerLabel.adjustsFontSizeToFitWidth=YES;
    [self.subCourerLabel setTextAlignment:NSTextAlignmentLeft];
    [self.subCourerLabel setTextColor:[UIColor darkGrayColor]];
    [self.subCourerLabel setFont:[UIFont systemFontOfSize:13]];
    [self addSubview:self.subCourerLabel];
    
    
    
    self.freeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 102, 15, 15)];
    [self addSubview:self.freeImageView];
    
    
    self.priceTit = [[UILabel alloc] initWithFrame:CGRectMake(20, 140, 50, 20)];
    [self.priceTit setTextAlignment:NSTextAlignmentCenter];
    [self.priceTit setTextColor:[UIColor darkGrayColor]];
    [self.priceTit setFont:[UIFont systemFontOfSize:14]];
    [self addSubview:self.priceTit];
    
    
    
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 140, 100, 20)];
    [self.priceLabel setTextAlignment:NSTextAlignmentCenter];
    [self.priceLabel setTextColor:[UIColor redColor]];
    [self.priceLabel setFont:[UIFont systemFontOfSize:14]];
    [self addSubview:self.priceLabel];
    
    
    self.payButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.payButton.layer.cornerRadius = 2;
    self.payButton.layer.masksToBounds = YES;
    [ self.payButton setFrame:CGRectMake(SCREEN_WIDTH-100, 140, 80, 20)];
    [ self.payButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview: self.payButton];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
